Class
	var
		name												//	Class name, such as Jedi
		numBAB												//	Base Attack Bonus
		list/lstDefenseBonus	= list("FORT","REF","WILL")	//	List of Defense bonuses
		list/lstTalentTrees		= list()					//	List of available talent trees
		list/lstFeats			= list()					//	List of bonus feats
		numStartCred			= 250						//	Starting credits. Multiplies the base roll (see set up)
		list/lstStartFeats		= list()					//	List of starting feats
		list/lstClassSkills		= list()					//	List of class skills
		numBaseSkills										//	Number of trained skills, not including INT bonus
		numForcePoints			= 5							//	Number of force points per level, base
		numHitDie				= 8							//	Hit die size
		//-----------------------------FLAGS AND SETTINGS-----------------------------------------------------------
		flagMinLevel	 		= 0							//	Required level to take a level in this class
		flagBaseClass 			= FALSE						//	FLAG defining if this is a base class (for feats)
		flagForceUser			= FALSE						//	FLAG defining if this is a force using class (see force options)

	New()
		..()
		if(flagForceUser && gameController.getForceCommon()) lstStartFeats.Add("Force Sensitive")
	proc
		setName()
		setBAB()
		setHitDie()
		setBaseNumberOfSkills()
		setForceUser()
		setBaseClass()
		setStartingFeats()
		setBonusFeats()
		setDefense()

		getName()
		getBAB()
		getHitDie()
		getBaseNumberOfSkills()
		getForceUser()
		getBaseClass()
		getDefenseBonus()

		loadFromXmlElement()

		countFeats()
		countTalents()

		isHeroic()

		canTake()

		applyClass()

		registerWithGame()

/////////////////////////////////////////////////////////////////////////////////////////////////////

	setDefense(txtDefense, numValue)
		numValue = text2num(numValue)
		if(!(lstDefenseBonus.Find(txtDefense))) CRASH("ERROR: Defense [txtDefense] does not exist")
		if(!isnum(numValue)) CRASH("ERROR: setDefense requires a number and was provided [numValue]")
		lstDefenseBonus[txtDefense] = numValue
		return TRUE

	setName(txtName as text)
		name = txtName

	setBAB(numBab as num)
		numBAB = numBab

	applyClass(Living/M)
		if(!canTake(M)) return FALSE
		for(var/f in lstStartFeats)
			M.addFeat(f)
		var/numAddHP = 0
		if(!(M.getHeroicLevel()))	//mob has no heroic classes
			numAddHP = 3*numHitDie
		else
			switch(gameController.getHPStyle())
				if(1)	numAddHP = (numHitDie/2)+1
				if(2)	numAddHP = numHitDie
				else	numAddHP = rand(1,numHitDie)
		numAddHP += M.getAttribute("CON","bonus")
		M.addMaxHitPoints(numAddHP, src)

	countFeats(numValue as num)
		if(flagBaseClass) return round(numValue/2)
		else return 0

	countTalents(numValue as num)
		return round( (numValue+1)/2 )

	isHeroic()
		return TRUE

	canTake(Living/livingMob)
		if(livingMob.getHeroicLevel() < flagMinLevel) return FALSE
		if(flagForceUser && !gameController.getForceCommon() && !livingMob.isForceSensitive()) return FALSE
		return TRUE

	getDefenseBonus(txtDefense as text)
		return lstDefenseBonus[txtDefense]

	loadFromXmlElement(XML/Element/xmlElement)
		setName(xmlElement.Attribute("name"))
		setHitDie(xmlElement.Attribute("hitdie"))
		setBaseNumberOfSkills(xmlElement.Attribute("skills"))
		setForceUser(xmlElement.Attribute("force"))
		setBaseClass(xmlElement.Attribute("base"))
		setDefense("FORT",xmlElement.Attribute("fort"))
		setDefense("REF",xmlElement.Attribute("ref"))
		setDefense("WILL",xmlElement.Attribute("will"))
		setBAB(xmlElement.Attribute("bab"))
		setStartingFeats(xmlElement.FirstChild("feats"))
		setBonusFeats(xmlElement.FirstChild("feats"))

		registerWithGame()

		//Log("Element = [xmlElement.Tag()]",EVENT_ERROR)


	setStartingFeats(XML/Element/xmlElement)
		for(var/XML/Element/xmlFeat in xmlElement.ChildElements())
			if(text2num(xmlFeat.Attribute("start"))) lstStartFeats.Add(xmlFeat.Attribute("name"))

	setBonusFeats(XML/Element/xmlElement)
		for(var/XML/Element/xmlFeat in xmlElement.ChildElements())
			if(!(text2num(xmlFeat.Attribute("start"))))	lstFeats.Add(xmlFeat.Attribute("name"))

	setBaseNumberOfSkills(numValue)
		numBaseSkills = text2num(numValue)

	setBAB(numValue)
		numBAB = text2num(numValue)

	setBaseClass(numValue)
		flagBaseClass = text2num(numValue)

	registerWithGame()
		lstGlobalClasses.Add(src.name)
		lstGlobalClasses[src.name] = src

//----------------------------------------------------------------------------------------------------------------------//

/*Jedi
	name = "Jedi"
	parent_type = /Class
	flagBaseClass = TRUE
	flagForceUser = TRUE
	lstDefenseBonus = list("FORT"=1,"REF"=1,"WILL"=1)
	numStartCred = 100
	numBAB = 1
	numHitDie = 10
	numBaseSkills = 2
	lstClassSkills= list("Acrobatics","Endurance","Initiative","Knowledge (Bureaucracy)","Knowledge (Galactic Lore)",
		"Knowledge (Life Sciences)","Knowledge (Physical Sciences)","Knowledge (Social Sciences)","Knowledge (Tactics)",
		"Knowledge (Technology)","Mechanics","Perception","Pilot")
	lstTalentTrees = list("Jedi Consular","Jedi Guardian","Jedi Sentinel","Lightsaber Combat")
	lstStartFeats = list("Weapon Proficiency (Lightsabers)","Weapon Proficiency (Simple Weapons)")

	//Note: to disable selection of Jedi at level 1, simple uncomment the next line. This class will then require at least
	//one level of another class before taking Jedi. You can tweak that as you like (change to 5, for example, will disable
	//jedi for anyone of level 5 or less

	//flagMinLevel = 1

	//See set up notes for other Force related options

Noble
	name = "Noble"
	parent_type = /Class
	flagBaseClass = TRUE
	lstDefenseBonus = list("FORT"=0,"REF"=1,"WILL"=2)
	numStartCred = 400
	numBAB = 0.75
	numHitDie = 6
	numBaseSkills = 6
	lstClassSkills= list("Deception","Gather Information","Initiative","Knowledge (Bureaucracy)","Knowledge (Galactic Lore)",
		"Knowledge (Life Sciences)","Knowledge (Physical Sciences)","Knowledge (Social Sciences)","Knowledge (Tactics)",
		"Knowledge (Technology)","Perception","Persuasion","Pilot","Ride","Treat Injury","Use Computer")
	lstTalentTrees = list("Influence","Inspiration","Leadership","Lineage")
	lstStartFeats = list("Linguist","Weapon Proficiency (Pistols)","Weapon Proficiency (Simple Weapons)")

Scoundrel
	name = "Scoundrel"
	parent_type = /Class
	flagBaseClass = TRUE
	lstDefenseBonus = list("FORT"=0,"REF"=1,"WILL"=2)
	numBAB = 0.75
	numHitDie = 6
	numBaseSkills = 4
	lstClassSkills= list("Acrobatics","Deception","Gather Information","Initiative","Knowledge (Bureaucracy)","Knowledge (Galactic Lore)",
		"Knowledge (Life Sciences)","Knowledge (Physical Sciences)","Knowledge (Social Sciences)","Knowledge (Tactics)",
		"Knowledge (Technology)","Mechanics","Perception","Persuasion","Pilot","Stealth","Use Computer")
	lstTalentTrees = list("Fortune","Misfortune","Slicer","Spacer")
	lstStartFeats = list("Point Blank Shot","Weapon Proficiency (Pistols)","Weapon Proficiency (Simple Weapons)")

Scout
	name = "Scout"
	parent_type = /Class
	flagBaseClass = TRUE
	lstDefenseBonus = list("FORT"=1,"REF"=2,"WILL"=0)
	numBAB = 0.75
	numHitDie = 8
	numBaseSkills = 5
	lstClassSkills= list("Climb","Endurance","Initiative","Jump","Knowledge (Bureaucracy)","Knowledge (Galactic Lore)",
		"Knowledge (Life Sciences)","Knowledge (Physical Sciences)","Knowledge (Social Sciences)","Knowledge (Tactics)",
		"Knowledge (Technology)","Mechanics","Perception","Pilot","Ride","Stealth","Survival","Swim")
	lstTalentTrees = list("Awareness","Camouflage","Fringer","Survivor")
	lstStartFeats = list("Shake it Off","Weapon Proficiency (Pistols)","Weapon Proficiency (Rifles)","Weapon Proficiency (Simple Weapons)")

Soldier
	name = "Soldier"
	parent_type = /Class
	flagBaseClass = TRUE
	lstDefenseBonus = list("FORT"=2,"REF"=1,"WILL"=0)
	numBAB = 1
	numHitDie = 10
	numBaseSkills = 3
	lstClassSkills= list("Climb","Endurance","Initiative","Jump","Knowledge (Tactics)","Mechanics","Perception","Pilot","Swim",
		"Treat Injury","Use Computer")
	lstTalentTrees = list("Armor Specialist","Brawler","Commando","Weapon Specialist")
	lstStartFeats = list("Armor Proficiency (Light)","Armor Proficiency (Medium)","Weapon Proficiency (Pistols)",
		"Weapon Proficiency (Rifles)","Weapon Proficiency (Simple Weapons)")
*/